home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: netcom.com!vala
- From: vala@netcom.com (habibollah valanejad)
- Subject: CreateProcessAsUser() using VC++ on NT !
- Message-ID: <valaDo4LxI.K4s@netcom.com>
- Organization: NETCOM On-line Communication Services (408 261-4700 guest)
- Date: Mon, 11 Mar 1996 23:15:18 GMT
- Sender: vala@netcom10.netcom.com
-
-
- Hi There,
- Here is my problem and hope I can find someone to help me. I have to run
- a process on NT, as another user. I'm using CreateProcessAsUser()
- , but it always returns an error to me. Here is what i do :
- I call LogonUser() for creating a handle for Habib (myself) on my machine.
- Habib on my machine is a member of admin group and also can logon as a
- batch job and service. Here is how i call it :
-
- if (LogonUser(
- ptr[1], // Username
- ptr[2], // Domain
- ptr[3], // Password
- LOGON32_LOGON_BATCH,LOGON32_PROVIDER_DEFAULT,
- &hand) != TRUE){
- GetLastError();^
- return (FALSE); /* Not successful */
- }
-
- I don't have problem with LogonUser() and it works.
- Then i pass that handle to CreateProcessAsUser() :
-
- if ( (CreateProcessAsUser(hand, NULL, buf, NULL, NULL, TRUE,
- NORMAL_PRIORICLASS,
- NULL,NULL, &StartupInfo, &ProcessInfo)) == TRUE)
- return(TRUE);
-
- but I always get this error message :
-
- ERROR_PRIVILEGE_NOT_HELD (error # 1314)
-
- Anyone out there has ever worked with this function ?
-
- Best Regards,
- Habib
- vala@netcom.com
-
-